package com.lyc.lojbackendjudgeservice.judge.strategy.impl;

import com.lyc.lojbackendjudgeservice.judge.strategy.JudgeContext;
import com.lyc.lojbackendmodel.model.codesandbox.JudgeInfo;

/**
 * Java程序判题策略
 */
public class GoLangLanguageJudgeStrategy extends JudgeStrategyTemplate {
    /**
     * 执行判题
     *
     * @param judgeContext
     * @return
     */

    private static final long EXTRA_EXECUTION_TIME = 15000L; // 15秒钟
    @Override
    public JudgeInfo doJudge(JudgeContext judgeContext) {
        return super.doJudge(judgeContext);
    }

    @Override
    public boolean checkTimeLimit(Long time, Long needTimeLimit) {
        // 如果实际执行时间超过题目规定的时间限制，加上额外执行时间后，返回 true 表示超时
        return time - EXTRA_EXECUTION_TIME > needTimeLimit;
    }


}
